home *** CD-ROM | disk | FTP | other *** search
/ Complete Internet Archive / Complete Internet Archive.iso / Web Boards / WebForum_tar(2).Z / WebForum_tar(2) / WebForum / src / top.pl < prev    next >
Encoding:
Text File  |  1995-01-23  |  1.6 KB  |  79 lines

  1. #
  2. # top-level access: show all the Forums
  3. #
  4. # Copyright (C) 1994 Afzal Ballim
  5.  
  6. ############################################################
  7. #
  8. # WFCommandTop: display all of the available forums.
  9. #
  10. sub WFCommandTop {
  11. local (%in)=@_;
  12.  
  13. # check to see if this has been called with a sort option
  14. # if not set alphabetic by default
  15. if ($in{"sortmethod"} eq "") {
  16.  $in{"sortmethod"}="alphabetic";
  17. }
  18.  
  19. # get the list of directories in the spool directory.
  20. # Those are the forums
  21. opendir(DIR,"ABSWFSPOOL");
  22. @slist=readdir(DIR);
  23. close(DIR);
  24.  
  25. #get the info for the directories
  26. for (@slist) {
  27.     next unless -d "ABSWFSPOOL/$_";
  28.     next if $_ eq '.';
  29.     next if $_ eq '..';
  30.     push(@forums,$_);
  31. }
  32.  
  33. $thelist="";
  34.  
  35. # sort the forums
  36. if ($in{"sortmethod"} eq "alphabetic") {
  37.     @forums=sort @forums; }
  38. else {
  39.     @forums = sort WFTopstatbymostrecent @forums;
  40. }
  41.  
  42. foreach $fname (@forums) {
  43.     $fnamedec=&WFDecodeDatum($fname);
  44.     $thelist = $thelist . <<EI;
  45. <li>
  46. <form method="POST" action="STD_DOCOMMAND">
  47. <input type="hidden" name="command" value="forum">
  48. <input type="hidden" name="forum" value="$fname">
  49. <input type="submit" value="$fnamedec">
  50. </form>
  51. </li>
  52. EI
  53. }
  54.  
  55. if ($in{"sortmethod"} eq "alphabetic") {
  56.     &WFIncFile("ABSWFHTML/TOP.HTML",
  57.         FORUMLIST,"$thelist",
  58.         SORTYPE,"$in{sortmethod}",
  59.         ASORT,checked,
  60.         MRCSORT,'') }
  61. else {
  62.     &WFIncFile("ABSWFHTML/TOP.HTML",
  63.         FORUMLIST,"$thelist",
  64.         SORTYPE,"$in{sortmethod}",
  65.         ASORT,'',
  66.         MRCSORT,checked) }
  67.  
  68. return "";
  69. }
  70.  
  71. sub WFTopstatbymostrecent {
  72.  local (@d1) = stat("ABSWFSPOOL/$a");
  73.  local (@d2) = stat("ABSWFSPOOL/$b");
  74.  $d2[9] <=> $d1[9]; 
  75. }
  76.  
  77. 1;
  78.